package com.huluobo.high3videoproject.mvp.fullscreen.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;

public class VideoRecyclerView extends RecyclerView {

    public VideoRecyclerView(@NonNull Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    //是否拦截事件
    private boolean isInterceptor = false;

    public void setInterceptor(boolean interceptor) {
        isInterceptor = interceptor;
    }

    /**
     * 事件拦截
     *
     * @param e The motion event being dispatched down the hierarchy.
     * @return 默认返回true, 不拦截事件且当前组件处理事件, 涂若返回false, 拦截事件且当前组件不处理事件
     */
    @Override
    public boolean onInterceptTouchEvent(MotionEvent e) {
        if (isInterceptor) {
            return false;
        }
        return super.onInterceptTouchEvent(e);
    }
}
